home *** CD-ROM | disk | FTP | other *** search
/ Alles Voor Internet / Tout Pour Internet / alles voor internet.iso / MacInternet™ / Net / Utilities / Seer family 2.0 / seer_common / sc_st_misc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-11-17  |  3.3 KB  |  131 lines  |  [TEXT/KAHL]

  1. /*
  2.     sc_st_misc.c - general routines for the status window
  3. */
  4.  
  5. #include "sc.h"
  6. #include "sc_count_window.h"
  7. #include "sc_event.h"
  8. #include "sc_seer_globals.h"
  9. #include "sc_filter.h"
  10.  
  11. #define    inQ_x 4
  12. #define    inQ_y 10
  13. #define    inQ "\pin Q:"
  14.  
  15. void st_update(void);
  16. void st_update()
  17. {draw_paks_in_Q();
  18. }
  19.  
  20. void st_activate(void);
  21. void st_activate()
  22. {
  23. }
  24.  
  25. void st_deactivate(void);
  26. void st_deactivate()
  27. {
  28. }
  29. void st_mouse_down(EventRecord *);
  30. void st_mouse_down(a_event)
  31. EventRecord *a_event;
  32. {
  33. }
  34. void st_grow(Point);
  35. void st_grow(where)
  36. Point where;
  37. {
  38. }
  39.  
  40.  
  41. void st_new_windef()
  42. {
  43.  if(gl.wdf_status!=NIL) {            /*already have a status window?*/
  44.      /*yes, we can only have one, make sure it is visible*/
  45.      if(&gl.wdf_status->windat.port!=FrontWindow())     /*is status window frontmost?*/
  46.          SelectWindow(gl.wdf_status);    /*no, bring it to the front*/
  47.      return;
  48.      }
  49.  
  50.  if(new_windef(WD_status)) {                /*if we can make a window*/
  51.     if(sizeof(status_windef)>PRIVATE_SIZE)
  52.       bomb(BOMB_noctl,BMB_no_os,(long)0);    /* fix this bomb */
  53.     /*initilize the new display windef*/
  54.     gl.wdf_status=gl.cur_windef;
  55.     gl.cur_windef->w_draw=st_update;
  56.      gl.cur_windef->w_mouse_down=st_mouse_down;
  57.      gl.cur_windef->w_activate=st_activate;
  58.      gl.cur_windef->w_deactavate=st_deactivate;
  59.      gl.cur_windef->w_grow=st_grow;
  60.      STW_wdf->last_paks_in_Q = -1;    /*force an update, can't match this*/
  61.      STW_wdf->inq_rect=CUR_WINDOW->portRect;
  62.      STW_wdf->inq_rect.bottom=10;
  63.      }
  64. }
  65.  
  66. void print_cntr(int,int);
  67. void print_cntr(a_tab,a_cnt)
  68. int a_tab,a_cnt;
  69. {uint16 cnt_nam;
  70.  cnt_nam=my_filter.counts[a_tab].acnt_tab[a_cnt].filname;
  71.  if(cnt_nam==0) {
  72.      DrawString(RES_pstr(my_filter.counts[a_tab].tab_nam));
  73.      DrawString("\p/");
  74.      DrawNum((long)a_cnt);
  75.      }
  76.  else
  77.   DrawString(RES_pstr(cnt_nam));
  78. }
  79.  
  80. /*see if there are a different number of packets in the queue since*/
  81. /*the last time we checked*/
  82. void check_paks_in_Q()
  83. {GrafPtr save_port;
  84.  if(gl.wdf_status==NIL)    /*is there a status window?*/
  85.      return;                /*no, so no need to update it*/
  86.  /*if there is nothing new in the queue, then no need to update the display*/
  87.  if(STW_wdf->last_paks_in_Q==sp_status->h_inuse)
  88.      return;
  89.  
  90.  /*request an update of the region status region*/
  91.  GetPort(&save_port);            /*save the old graf port*/
  92.  SetPort(&gl.wdf_status->windat); /*switch to the port to update*/
  93.  InvalRect(&STW_wdf->inq_rect);
  94.  SetPort(save_port);
  95. }
  96.  
  97. /*
  98.     handle an update event for the status window
  99.     GrafPtr set to the window to update
  100. */
  101. void draw_paks_in_Q()
  102. {register int i;
  103.  STW_wdf->last_paks_in_Q = sp_status->h_inuse;    /*update the last set we have seen*/
  104.  MoveTo(inQ_x,inQ_y);
  105.  DrawString(inQ);
  106.  DrawNum((long)STW_wdf->last_paks_in_Q);
  107.  DrawChar('/');
  108.  DrawNum(sp_status->d_inuse);
  109.  for(i=0;i<=PE_max;i++) {
  110.   DrawString("\p ");
  111.   DrawString(RES_pstr(my_filter.counts[err_tbi].acnt_tab[i].filname));
  112.   DrawString("\p:");
  113.   DrawNum(my_filter.counts[err_tbi].acnt_tab[i].count);}
  114.   
  115.  MoveTo(4,25);
  116.  DrawString(
  117.      "\pSeer v2.0/public domain/under construction/from Carnegie Mellon University");
  118.  MoveTo(4,40);
  119.  DrawString("\pCenter for Art & Technology/by Aaron Wohl/work:(412)-268-3454/home:(412)-7316159");
  120. #ifdef xxxyyy
  121.  for(i=0;i<256;i++) {
  122.       if(my_filter.counts[lap_ty_tbi].acnt_tab[i].count==0)
  123.            continue;
  124.       DrawString("\p ");
  125.       print_cntr(lap_ty_tbi,i);
  126.       DrawString("\p:");
  127.       DrawNum(my_filter.counts[lap_ty_tbi].acnt_tab[i].count);
  128.       }
  129. #endif
  130. }
  131.